﻿@page "/doc/{id?}"
@inject IJSRuntime JS;

<div class="doc-container">
    <div id="docNav" class="doc-sider">
        <DocMenu CurItem="@curItem" />
    </div>
    <div class="doc-content markdown-body">
        <span class="doc-nav oi oi-menu" @onclick="OnDocNavClick"></span>
        @DocService.GetDocHtml(curItem)
    </div>
</div>

@code {
    private string? curItem => Id ?? "profile";

    [Parameter] public string? Id { get; set; }

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        await JS.InvokeVoidAsync("codeHighlight");
        await base.OnAfterRenderAsync(firstRender);
    }

    private async void OnDocNavClick()
    {
        await JS.InvokeVoidAsync("showDocNav");
    }
}